import request from '@/utils/request'

export function getTree() {
  return request({
    url: '/vue-admin-template/v1/api/dept/getTree',
    method: 'get'
  })
}
export function getRoutes() {
  return request({
    url: '/vue-admin-template/v1/api/dept/routes',
    method: 'get'
  })
}

export function getDept(query) {
  return request({
    url: '/vue-admin-template/v1/api/dept/list',
    method: 'post',
    data: query
  })
}

export function createDept(data) {
  return request({
    url: '/vue-admin-template/v1/api/dept',
    method: 'post',
    data
  })
}

export function updateDept(data) {
  return request({
    url: `/vue-admin-template/v1/api/dept`,
    method: 'put',
    data
  })
}

export function deleteDept(id) {
  return request({
    url: `/vue-admin-template/v1/api/dept/${id}`,
    method: 'delete'
  })
}
